<?php
header('content-type:text/plain;charset=utf-8');
session_start();

$cookie_file = tempnam('./temp','cookie');
// if (!isset($_GET['nologin'])) {
	$actionUrl = 'http://192.168.2.4:8888/login.aspx';
	$postData = array(
		'username'	=> '陈立强',
		'password'	=> '951753',
	);
	
	$ch = curl_init($actionUrl);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	// curl_setopt($ch, CURLOPT_NOBODY, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
	
	$html = curl_exec($ch);
	curl_close($ch);
	
	// echo $html;
// 	preg_match_all('~Set-Cookie: (.*)~i', $html, $m);
	// var_export($m);
	// exit;
// 	$cookie = str_replace(' path=/', '', $m[1][1]);
// 	$_SESSION['cookie'] = $cookie;
// 	header('location:autoDiscuz.php?nologin');
// 	exit;
// }
// $cookie = $_SESSION['cookie'];
// echo $cookie;

	


$url = 'http://192.168.2.4:8888/posttopic.aspx?forumid=182&forumpage=1';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_COOKIE, 'dnt=userid=139&password=GZStxxduFbMQQRafYj8d2GJzVDrTRBcySVqVafXlWBkkjw%2f8JQPOeA%3d%3d&tpp=0&ppp=0&pmsound=0&invisible=0&referer=index.aspx&sigstatus=1&expires=-1;');
// echo $m[1][1];
// exit;
$cookie = 'dnt=userid=139&password=GZStxxduFbMQQRafYj8d2GJzVDrTRBcySVqVafXlWBkkjw%2f8JQPOeA%3d%3d&tpp=0&ppp=0&pmsound=0&invisible=0&referer=index.aspx&sigstatus=1&expires=-1;';
// curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

$html = curl_exec($ch);
curl_close($ch);


echo $html;









